package cn.livingCloud.dto;

import cn.livingCloud.entity.core.CaseCategory;
import org.apache.commons.lang.StringUtils;

/**
 * Created by 唐旭 on 2016/6/2.
 */
public class CaseCategoryFormDto extends CaseCategoryDto {
    private String content;

    public CaseCategoryFormDto() {
    }

    public CaseCategoryFormDto(CaseCategory category) {
        super(category);
        this.content = category.getContent();
    }

    public String getContent() {
        return content;
    }

    public CaseCategoryFormDto setContent(String content) {
        this.content = content;
        return this;
    }

    public void update(CaseCategory caseCategory) {
        caseCategory.setName(this.getName());
        caseCategory.setContent(this.getContent());
        CaseCategoryDto parent = getParent();
        if (parent != null && StringUtils.isNotEmpty(parent.getUuid())) {
            caseCategory.setParentUuid(getParent().getUuid());
        }
    }
}
